package com.autumn.util.data;

import java.util.List;

import com.autumn.common.api.application.dto.output.PageQueryResult;
import com.autumn.mybatis.criterion.IQuerySection;
import com.autumn.mybatis.criterion.Query;
import com.autumn.util.function.FunctionOneResult;
import com.autumn.util.function.FunctionTwoAction;

/**
 * 公共页查询生成器
 * 
 * @author 老码农
 *
 *         2018-04-11 11:28:25
 */
public class CommonPageQueryBuilder extends AbstractPageQueryBuilder<CommonPageQueryBuilder> {

	private final Query query;

	/**
	 * 
	 */
	public CommonPageQueryBuilder() {
		this.query = new Query();
	}

	@Override
	public Query getQuery() {
		return this.query;
	}

	@Override
	public <TResult> PageQueryResult<TResult> toPageResult(FunctionOneResult<IQuerySection, Integer> countDelegate,
			FunctionOneResult<IQuerySection, List<TResult>> queryDelegate) {
		return super.toPageResult(countDelegate, queryDelegate);
	}

	@Override
	public <TEntity, TResult> PageQueryResult<TResult> toPageResult(
			FunctionOneResult<IQuerySection, Integer> countDelegate,
			FunctionOneResult<IQuerySection, List<TEntity>> queryDelegate, Class<TResult> resultClass) {
		return super.toPageResult(countDelegate, queryDelegate, resultClass);
	}

	@Override
	public <TEntity, TResult> PageQueryResult<TResult> toPageResult(
			FunctionOneResult<IQuerySection, Integer> countDelegate,
			FunctionOneResult<IQuerySection, List<TEntity>> queryDelegate, Class<TResult> resultClass,
			FunctionTwoAction<TEntity, TResult> convertDelegate) {
		return super.toPageResult(countDelegate, queryDelegate, resultClass, convertDelegate);
	}

}
